import java.util.ArrayList;
import java.util.List;

public class UserSericeImpl implements UserService {

	private List<User> userList = new ArrayList<User>();

	@Override
	public void create(User user) {

		userList.add(user);
	}

	@Override
	public List<User> getAll() {
		return userList;
	}

	@Override
	public User delete(String userName) {
		for(int i = 0; i < userList.size(); i++){
			User user = userList.get(i);
			
			if(user.getUserName().equalsIgnoreCase(userName)) {
				userList.remove(i);
				return user;
			}
		}
		
		return null;
	}

}
